package com.zoroki.student_score_system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zoroki.student_score_system.domain.Major;
import com.zoroki.student_score_system.service.MajorService;
import com.zoroki.student_score_system.mapper.MajorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【major】的数据库操作Service实现
* @createDate 2025-06-30 12:49:22
*/
@Service
public class MajorServiceImpl extends ServiceImpl<MajorMapper, Major>
    implements MajorService{
    @Autowired
    private MajorMapper majorMapper;


    @Override
    public List<Major> findAllMajor() {
        return majorMapper.selectList(null);
    }

    @Override
    public Major findMajorById(int id) {
        return majorMapper.selectById(id);
    }

    @Override
    public boolean updateMajor(Major major) {
        return majorMapper.updateById(major) >0;
    }

    @Override
    public boolean deleteMajor(int id) {
        return majorMapper.deleteById(id) > 0;
    }

    @Override
    public boolean addMajor(Major major) {
        return majorMapper.insert(major) > 0;
    }
}




